<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let num1 = +prompt('输入第一个数字')
        let num2 = +prompt('输入第二个数字')
        let H = prompt('运算符')
        // 注意要运算符要加引号，因为输入的是字符串
        switch (H) {
            case '*':
                alert(num1 * num2)
                break
            case '+':
                alert(num1 + num2)
                break
            case '-':
                alert(num1 - num2)
                break
            case '/':
                alert(num1 / num2)
                break
            default:
                alert('输入错误')
                break
        }
    </script>
</body>

</html>